$(document).ready(function(){
	$('.btn').click(function(){
		 
		
			var target  = $(this).attr('target');
			var datas;
			if ('password' != target ){
				var input = $(this).parent('td').parent('tr').find(':text').val();
				datas = {value : input};	
			}else{
				var confpwd = $('#confpwd').val();
					var newpwd = $('#newpwd').val();
					var odpwd  = $('#odpwd').val();
					if (odpwd==null){
						alert ('please key in old password');	
						return
					}
					if (confpwd != newpwd){
						alert ('password not same');
						return
					}
				datas = {
					'oldpwd' : odpwd,
					'newpwd' : newpwd	
				}
			}
			
		var url = '/pub-member/profile/'+target+'/';
			var submit = {
		type : "POST",
		dataType : "json",
		data :datas,
		success : function(data) {
		if (data && data.state && (data.state.indexOf("ERROR") != -1)) {
			alert (data.message);
			} else {
			alert ("successfully update");
			}
			}}
			submit.url = url;
			$.ajax(submit);


});
	
});

  